//
//  HRSearchUsersViewModel.m
//  Hear
//
//  Created by mac on 2017/6/6.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRSearchUsersViewModel.h"

@implementation HRSearchUsersViewModel
-(void)getSearchResultUsersInfo:(NSDictionary *)requstDict isSeccess:(void(^)(HRUpdataUserInfoModel *userModel))isSeccess{
    YTKApi *api = [YTKApi apiGetWithUrl:@"UserInfo/Get_GetUserInfo" para:requstDict];
    [api getSuccessToken:^() {
        api.foceNoTocken = NO;
        [api setRequestSerializerType:YTKRequestSerializerTypeJSON];
        [api startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
            NSDictionary *dict = request.responseJSONObject;
            HRUpdataUserInfoModel *model = [HRUpdataUserInfoModel modelWithJSON:dict[@"BodyContent"]];
            isSeccess(model);
        } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        }];
    }];
}

-(void)getSerachUser:(NSMutableDictionary*)paramDict contentArr:(void(^)(NSArray *contentArr))contentArr{
    YTKApi *api = [YTKApi apiGetWithUrl:@"UserInfo/Get_SerachUser" para:paramDict];
    [api getSuccessToken:^() {
        api.foceNoTocken = NO;
        [api setRequestSerializerType:YTKRequestSerializerTypeJSON];
        [api startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
            NSDictionary *dict = request.responseJSONObject;
            NSArray *resultArr = [NSArray modelArrayWithClass:[HRUpdataUserInfoModel class] json:dict[@"BodyContent"]];
            contentArr(resultArr);
        } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        }];
    }];
}
@end
